Add a test for PR #1012
authorAlex Crichton <alex@alexcrichton.com>
Thu, 18 Dec 2014 00:32:20 +0000 (16:32 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 18 Dec 2014 00:32:20 +0000 (16:32 -0800)
tests/test_cargo_cross_compile.rs

index db5034125a412ef15c395ecc8f59dce5bb6b2eda..2c7e980d5659e83b043a8d69ef1e7bb16e1491ef 100644 (file)
@@ -639,3 +639,44 @@ test!(build_deps_for_the_right_arch {
     assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"),
                 execs().with_status(0));
 })
+
+test!(build_script_only_host {
+    if disabled() { return }
+
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [package]
+            name = "foo"
+            version = "0.0.0"
+            authors = []
+            build = "build.rs"
+
+            [build-dependencies.d1]
+            path = "d1"
+        "#)
+        .file("src/main.rs", "fn main() {}")
+        .file("build.rs", "extern crate d1; fn main() {}")
+        .file("d1/Cargo.toml", r#"
+            [package]
+            name = "d1"
+            version = "0.0.0"
+            authors = []
+            build = "build.rs"
+        "#)
+        .file("d1/src/lib.rs", "
+            pub fn d1() {}
+        ")
+        .file("d1/build.rs", r#"
+            use std::os;
+
+            fn main() {
+                assert!(os::getenv("OUT_DIR").unwrap()
+                                             .contains("target/build/d1-"),
+                        "bad: {}", os::getenv("OUT_DIR"));
+            }
+        "#);
+
+    let target = alternate();
+    assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"),
+                execs().with_status(0));
+})